import request from '@/config/axios'

// 共享用药计划 VO
export interface SharedMedicationVO {
  shareId: number // 共享ID
  planId: number // 计划ID
  sharedBy: number // 共享人ID
  sharedTo: number // 被共享人ID
  accessLevel: number // 访问权限(1:只读,2:可操作)
  shareTime: Date // 共享时间
  isActive: boolean // 是否有效
}

// 共享用药计划 API
export const SharedMedicationApi = {
  // 查询共享用药计划分页
  getSharedMedicationPage: async (params: any) => {
    return await request.get({ url: `/remind/shared-medication/page`, params })
  },

  // 查询共享用药计划详情
  getSharedMedication: async (id: number) => {
    return await request.get({ url: `/remind/shared-medication/get?id=` + id })
  },

  // 新增共享用药计划
  createSharedMedication: async (data: SharedMedicationVO) => {
    return await request.post({ url: `/remind/shared-medication/create`, data })
  },

  // 修改共享用药计划
  updateSharedMedication: async (data: SharedMedicationVO) => {
    return await request.put({ url: `/remind/shared-medication/update`, data })
  },

  // 删除共享用药计划
  deleteSharedMedication: async (id: number) => {
    return await request.delete({ url: `/remind/shared-medication/delete?id=` + id })
  },

  // 导出共享用药计划 Excel
  exportSharedMedication: async (params) => {
    return await request.download({ url: `/remind/shared-medication/export-excel`, params })
  },
}